﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using myBoard.Framework;

namespace MagnetTemplate
{
    /// <summary>
    /// Interaction logic for EmptyMagnet.xaml
    /// </summary>
    public partial class EmptyMagnet : UserControl , IMagnet
    {
        /// <summary>
        /// This is the magnet constructor, add all initialization code here.
        /// </summary>        
        public EmptyMagnet()
        {
            InitializeComponent();

            #region Optional code : Remove comments here if you want the magnet to flip when you click on it.
         
            //_frontBg.MouseLeftButtonUp += new MouseButtonEventHandler(_frontBg_MouseLeftButtonUp);
            //_backBg.MouseLeftButtonUp += new MouseButtonEventHandler(_backBg_MouseLeftButtonUp);            

            #endregion
        }

        #region Optional code : Remove comments here if you want the magnet to flip when you click on it.

        /*
        void _backBg_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            FlipRequested(MagnetSides.Front);
        }

        void _frontBg_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            FlipRequested(MagnetSides.Back);
        }
         */

        #endregion

        #region IMagnet Members

        #region Magnets events for myBoard

        /// <summary>
        /// This event should be raised when you want to hide myBoard
        /// </summary>
        public event EventHandler CloseMyBoardRequested;

        /// <summary>
        /// This event should be raised when you want to flip your magnet
        /// </summary>
        public event OnFlipRequested FlipRequested;

        #endregion

        #region Magnets methods

        /// <summary>
        /// This method should return the magnet's back side container (what is going to be displayed when you flip the magnet)
        /// You can return null if your magnet doesn't have any backside.
        /// </summary>
        /// <returns></returns>
        public Panel GetBackSide()
        {
            return _back;
        }

        /// <summary>
        /// When you flip a magnet, myBoard need to add a special 3D control in the magnet to create the flip animation.
        /// This method returns the container myBoard should use to put the 3D control for flip animation.
        /// You can return null if your magnet doesn't have any backside.
        /// </summary>
        /// <returns></returns>
        public Panel GetFlipZone()
        {
            return _flipZone;
        }

        /// <summary>
        /// This method returns the magnet's front side container (what is being displayed when you first drop the magnet.
        /// </summary>
        /// <returns></returns>

        public Panel GetFrontSide()
        {
            return _front;
        }

        /// <summary>
        /// This method returns the magnet Logo (the little magnet icon displayed in the magnet explorer).
        /// The Logo being a UserControl, it can be a simple UserControl hosting an image, or a fully animated, interactive control.
        /// </summary>
        /// <returns></returns>
        public UserControl GetLogo()
        {
            return new Logo();
        }

        /// <summary>
        /// This method returns the magnet Thumbnail, which is what the magnet should look like when you drag it out of the magnet explorer.
        /// The Thumbnail being a UserControl, it can be a simple UserControl hosting an image, or a fully animated, interactive control.
        /// </summary>
        /// <returns></returns>
        public UserControl GetThumb()
        {
            return new Thumb();
        }

        /// <summary>
        /// This is where you define your magnet's name. It is used in the magnet explorer just under the magnet logo.
        /// </summary>
        public string MagnetName
        {
            get { return "Empty magnet"; }
        }

        /// <summary>
        /// This method is regulary called by myBoard to saved the magnet state.  
        /// Note : This method will most likely be renamed in next version of myBoard.
        /// </summary>
        public void Terminate()
        {
            
        }

        #endregion

        #endregion
    }
}